@use "variables" as var;
@use "mixins";

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  margin-bottom: 4px;
  font-size: 0.8rem;
  background: var(--c-button-background);
  border: var(--c-border) var.$border-width solid;
  height: var.$tab-height;
  line-height: normal;

  &:hover {
    background: initial;
  }

  &:has([role="tab"][aria-selected=true]) {
    background: initial;
    border-bottom: rgba(255,255,255,0) var.$border-width solid;

    &::before {
      content: '';
      position: absolute;
      top: - var.$border-width;
      left: 0;
      width: 100%;
      height: var.$tab-highlight-height;
      background-color: var(--c-primary);
    }
  }
}

.tabButton {
  @include mixins.reset-button;

  display: inline-flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 0 0.5rem;
}

.editableTabBody {
  display: inline-block;
  position: relative;

  .fileNameForm {
    position: absolute;
    width: 100%;
    left: 0;
    top: 0;
  }

  .fileNameInput {
    @include mixins.reset-input;

    display: inline-block;
    width: 100%;
  }
  .fileNameInputError {
    border: red 1px solid;
  }
}

.entrypointIndicator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.3rem;
  position: relative;

  .tooltip {
    display: none;

    position: absolute;
    top: 0;
    transform: translate(0, -50%);
    left: 100%;
    z-index: 1;
    font-size: 0.7rem;
    text-align: center;
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    background-color: rgba(0,0,0,0.6);
    color: #fff;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    pointer-events: none;
  }

  &:hover .tooltip {
    display: block;
  }
}

.dropdownButton {
  @include mixins.reset-button;

  display: flex;
  width: 1rem;
  height: 100%;
  align-items: center;
  justify-content: center;
  margin-left: -0.5rem;

  font-size: 0.6rem;
  cursor: pointer;

  &:hover {
    color: var(--c-primary);
  }
}

.dropdownContent {
  display: flex;
  flex-direction: column;
  color: var(--c-text);
  background-color: var(--c-background);
  border: var(--c-border) 1px solid;
  box-shadow: 0px 8px 16px 0px rgba(200, 200, 200, 0.3);
  padding: 0;
  margin: 0;
  z-index: 10;

  li {
    display: flex;
    list-style: none;

    &:hover {
      background-color: var(--c-background-hover);
    }

    button {
      @include mixins.reset-button;

      display: flex;
      align-items: center;
      gap: 0.5rem;
      width: 100%;
      height: 100%;
      white-space: nowrap;
      text-align: left;
      font-size: 0.8rem;
      padding: 8px 16px;
      cursor: pointer;
    }
  }
}
